package cn.taobaoke.restful.domain;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

/**
 * ProductEntity类.
 * +-----------------------------------------------------------------------------------------------+
 * |类名称: ProductEntity                                                                         |
 * |创建时间: 3/17/17                                                                               |
 * |功能简介:                                                                                       |
 * |参考链接:                                                                                       |
 * +-----------------------------------------------------------------------------------------------+
 *
 * @author luch
 */
@ToString
@Setter
@Getter
@Entity
@Table(name = "tb_product")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ProductEntity implements Serializable {

    @Id
    @GeneratedValue
    private Long id;         // 在我们这边的流水Id

    @Column
    private String seq;              // 流水号
    @Column
    private String source;          // 数据来源
    @Column
    private String sourceNo;       // 流水号(坚果的)
    @Column
    private Timestamp edit;         // (好像是更新时间戳) b.edit + 36E5 > q.now() && a.div(["tao-product-new", "tao-icon"], c); 一个小时前的商品
    @Column
    private String itemId;          // 商品编号
    @Column
    private String itemName;
    @Column
    private String itemImage;       // 加上后缀, 设置图片大小 "_480x480q90.jpg"
    @Column
    private Double itemPrice;
    @Column
    private Integer itemSales;  // 月销售
    @Column
    private Integer itemType;   // 商品类型, 当type = 1 好像是通用, type = 2的时候, 好像是内部优惠券地址参数有变动, 需要加上 &dx = 1什么鬼
    /*
     var b = "https://uland.taobao.com/coupon/edetail?activityId=" + a.couponActivity + "&itemId=" + a.itemId + "&src=jgmh_wsmh";
        2 !== a.itemType && (b += "&dx=1");
        w && (b += "&pid=" + w);
        return b
     */
    @Column
    private Integer itemRate; // 分佣比例 = 百分比 * 100.
    @Column
    private String shopSeller; // seller id
    @Column
    private Integer shopType;   // 商品类型, 1 - 天猫  https://detail.tmall.com/item.htm?id={shopSeller} ,   2-淘宝?  https://item.taobao.com/item.htm?id={shopSeller}
    @Column
    private String shopName; // 卖家名称
    @Column
    private String couponActivity; // activity id
    @Column
    private Timestamp couponStart;  // 优惠券有效期 起始日
    @Column
    private Timestamp couponEnd;    // 优惠券有效期 截止日期
    @Column
    private Double couponFee;       // 优惠券面额. 也就是必须满多少额度,才能有这个面值的优惠券
    @Column
    private Double couponAmount;    // 优惠券额度
    @Column
    private Integer couponLeft;     // 剩余优惠券
    @Column
    private Integer couponTotal;    // 总优惠券

    @Column
    private String couponLink;     // 优惠券地址

    @Column
    private String article;

    @Column(length = 1000)
    private String intro;

    @Column
    private Long domainId;

    @Transient
    private String taobaoUrl;

    @Transient
    private Integer monthSale;

    // 是否添加了
    @Transient
    private Boolean choosedOrNot;


    @Transient
    private List<String> descImgs;


}
